#!/usr/bin/env sh

set -e

buildWeb() {
    module=$1

    reg_web_path=$module
    reg_dest=build-web/$module

    cd $reg_web_path
    npm i
    REACT_APP_ENV=production npm run build
    cd -

    mkdir -p $reg_dest
    cp -R $reg_web_path/build/*  $reg_dest
}

buildWeb 'register-web'
buildWeb 'home-web'

cp ci/web.Dockerfile build-web/Dockerfile
cp ci/default build-web/default

